<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css"></style>
</head>
<body>
    <h1>获取属性</h1>
    <hr>

    <img src="../图片/1.jpg" alt="美女图片" title="img001" width="600"  height="300" id="mying" teshudeci="abc" data-img="654321">
    
    <script>
        //  获取属性值
        console.log(myimg.src); // HTML DOM
        console.log(myimg.getAttribute('src')); // XML DOM
        console.log(myimg.getAttributeNode('src').nodeValue); // XML DOM

        // console.log(myimg.teshudeci); // NO
        // console.log(myimg.data-img); // NO
        console.log(myimg.getAttribute('teshudeci')); // XML DOM
        console.log(myimg.getAttribute('data-img')); // XML DOM

        console.log(myimg.getAttributeNode('teshudeci').nodeValue); //xml DOM
        console.log(mying.getAttributeNode('data-img').nodeValue);   //XML DOM
    </script>
</body>
</html>